package fr.utbm.aiechat.packets;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;

import fr.utbm.aiechat.structures.Channel;

public class InviteToChanPacket
{
	private ByteArrayOutputStream stream;

	public InviteToChanPacket(Channel chan, boolean showDialog)
	{
		stream = new ByteArrayOutputStream();
		
		try
		{
			ObjectOutputStream dataObj = new ObjectOutputStream(stream);

			dataObj.writeInt(Packets.CHANJOIN_REQUEST);
			
			dataObj.writeObject(chan);
			
			dataObj.writeObject(showDialog);
		}
		catch (IOException e)
		{
			e.printStackTrace();
		}
	}
	
	public byte[] getPacket()
	{
		return stream.toByteArray();
	}
}